package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.FileUploadMapper;
import com.ruoyi.system.domain.FileUpload;
import com.ruoyi.system.service.IFileUploadService;
import com.ruoyi.common.core.text.Convert;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * 文件上传记录Service业务层处理
 *
 * @author tanshen
 * @date 2023-10-19
 */
@Service
public class FileUploadServiceImpl extends ServiceImpl<FileUploadMapper, FileUpload> implements IFileUploadService {
    @Autowired
    private FileUploadMapper fileUploadMapper;

    /**
     * 查询文件上传记录
     *
     * @param id 文件上传记录主键
     * @return 文件上传记录
     */
    @Override
    public FileUpload selectFileUploadById(Long id) {
        return fileUploadMapper.selectFileUploadById(id);
    }

    /**
     * 查询文件上传记录列表
     *
     * @param fileUpload 文件上传记录
     * @return 文件上传记录
     */
    @Override
    public List<FileUpload> selectFileUploadList(FileUpload fileUpload) {
        return fileUploadMapper.selectFileUploadList(fileUpload);
    }

    /**
     * 新增文件上传记录
     *
     * @param fileUpload 文件上传记录
     * @return 结果
     */
    @Override
    public int insertFileUpload(FileUpload fileUpload) {
        fileUpload.setCreateTime(DateUtils.getNowDate());
        return fileUploadMapper.insertFileUpload(fileUpload);
    }

    /**
     * 修改文件上传记录
     *
     * @param fileUpload 文件上传记录
     * @return 结果
     */
    @Override
    public int updateFileUpload(FileUpload fileUpload) {
        fileUpload.setUpdateTime(DateUtils.getNowDate());
        return fileUploadMapper.updateFileUpload(fileUpload);
    }

    /**
     * 批量删除文件上传记录
     *
     * @param ids 需要删除的文件上传记录主键
     * @return 结果
     */
    @Override
    public int deleteFileUploadByIds(String ids) {
        return fileUploadMapper.deleteFileUploadByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除文件上传记录信息
     *
     * @param id 文件上传记录主键
     * @return 结果
     */
    @Override
    public int deleteFileUploadById(Long id) {
        return fileUploadMapper.deleteFileUploadById(id);
    }
}
